<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      background-color: lightblue;
      color: #fff;
      font-size: 18px;
      font-weight: bold;
      padding: 1em;
      border-radius: 4px;
    }
  </style>

 
</head>
<body>
  <div id="dom">
    hello world
  </div>

  <script>
    let dom = document.getElementById('dom')
    dom.onclick = function(){
      alert(1);
      window.location.href="http://www.baidu.com"
    }
  </script>
</body>
</html>